﻿using CastingWellEquipmentGUI.View.Pages.SettingMenuPages;
using CastingWellEquipmentGUI.ViewModel.Common.Command;
using GalaSoft.MvvmLight;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;

namespace CastingWellEquipmentGUI.ViewModel.Pages
{
    public class SettingMenuPageViewModel : ViewModelBase
    {

        public DelegateCommand GoToSettingPageCommand { get; set; }
        public SettingMenuPageViewModel()
        {
            GoToSettingPageCommand = new DelegateCommand()
            {
                ExecuteActionObj = new Action<object>(GoToSettingPageHandler)
            };
        }
        private Frame _SettingContent;
        public Frame SettingContent
        {
            get
            {

                if (_SettingContent == null)
                {
                    _SettingContent = new Frame() { Content = ControlTagSettingPage.Instance };
                }
                return _SettingContent;
            }
            set
            {
                _SettingContent = value;
                RaisePropertyChanged("SettingContent");
            }
        }
        private void GoToSettingPageHandler(object obj)
        {
            string parameter = obj.ToString();
            switch (parameter)
            {
                case "ControlTagSettingPage":
                    SettingContent = new Frame() { Content = ControlTagSettingPage.Instance };
                    break;
                case "RecipeTagSettingPage":
                    SettingContent = new Frame() { Content = RecipeTagSettingPage.Instance };
                    break;
                    
            }
        }
    }
}
